package to4.client;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.RootPanel;

public class Menu {
	private TO4 thema;
	private MenuBar myMenuBar;
	private ZonderHome home;
	private String email;
	public Menu(TO4 thema5){
		this.thema = thema5;
		this.home = new ZonderHome(thema5);
	}

	public void createMenu(){
		Command openManual = new Command() {
			public void execute() {
				Window.open("www.manual.nl", "Handleiding", null);
			}
		};

		Command openVervoer = new Command() {
			public void execute() {
				home.showVervoer1Zonder(email);
			}
		};
		Command openHome = new Command() {
			public void execute() {
				home.showHomeZonder(email);
			}
		};

		Command uitloggen = new Command() {
			public void execute() {
				thema.showInlog();
			}
		};

		Command openContact = new Command() {
			public void execute() {
				home.showContact(email);
			}
		};

		myMenuBar = new MenuBar();
		MenuBar helpMenu = new MenuBar(true);
		helpMenu.addItem("Handleiding", openManual);
		helpMenu.addItem("Contact", openContact);
		myMenuBar.addItem("Home", openHome);
		myMenuBar.addItem("Vervoer", openVervoer);
		myMenuBar.addItem("Help", helpMenu);
		myMenuBar.addSeparator();
		myMenuBar.addItem("Uitloggen", uitloggen);
		myMenuBar.setAutoOpen(true);
		RootPanel.get("menubar").add(myMenuBar);


	}

	public void setEmail(String e){
		email = e;
	}


}
